# 运算法

import torch

x = torch.tensor([1, 2.0, 4, 8])
y = torch.tensor([2, 2, 2, 2])

print(x + y)
print(x - y)
print(x * y)
print(x / y)

print(torch.exp(x))


X = torch.arange(12, dtype=torch.float).reshape(3, 4)
Y = torch.tensor([[2.0, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])


Z1 = torch.cat((X, Y), dim=0)
print(Z1.shape)

Z2 = torch.cat((X, Y), dim=1)
print(Z2.shape)


print(X==Y)

print(X.sum())